package com.foreknow.demo2;

import java.util.Scanner;

/**
 *   while循环
 */
public class Look3 {
    public static void main(String[] args) {
        // 商品的名称
        String name = "1";
        // 商品的价格
        double price = 2;
        // 编号
        int goodsNo;
        Scanner input = new Scanner(System.in);
        String gouwu = "";
        do {
            System.out.println("*************************");
            System.out.println("商品管理系统");
            System.out.println("请选择要购买的商品");
            System.out.println("1.AAAA 2.BBBB 3.CCCC");
            System.out.println("*************************");
            System.out.println("要购买的商品： ");
            goodsNo = input.nextInt();
            switch (goodsNo){
                case 1:
                    name = "AAAA";
                    price = 300 ;
                    break;
                case 2:
                    name = "BBBB";
                    price = 391 ;
                    break;
                case 3:
                    name = "CCCC";
                    price = 100 ;
                    break;
            }
            System.out.println("商品名称：" + name +"商品价格： " + price);
            System.out.println("是否继续(y/n)");
            gouwu = input.next();
        } while (gouwu.equals("y"));







































        //        int sun = 0;
//        for (int i = 1;i <= 50;i++){
//            sun += i;
//        }
//        System.out.println(sun);
    }
}
